package com.workshop.utils.session;

import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;

/**
 * session 监听器
 * @author chenluqiang
 * @date 2019年4月16日 下午3:58:33 
 *
 */
//@WebListener (web 监听器)
public class SessionListener implements HttpSessionListener{
	
	private SessionManager sessionManager = SessionManager.getInstance();
	
	@Override
	public void sessionCreated(HttpSessionEvent arg0) {
		HttpSession session = arg0.getSession();
		sessionManager.addSession(session);
	}

	@Override
	public void sessionDestroyed(HttpSessionEvent arg0) {
		HttpSession session = arg0.getSession();
		sessionManager.delSession(session);
	}

}
